﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class D07_XunLuo : MonoBehaviour
{
    private NavMeshAgent nav;
    public Transform points;
    private void Start()
    {
        nav = GetComponent<NavMeshAgent>();
        InvokeRepeating("ToTarget", Random.Range(0, 5), 10);
    }

    private void ToTarget()
    {
        nav.SetDestination(points.GetChild(Random.Range(0, points.childCount)).position);
    }
}